package com.yboot.starter.caffeine.config;

import com.yboot.starter.caffeine.core.LocalCache;
import com.yboot.starter.api.core.cache.CacheService;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 服务本地缓存或者字典
 * 单机服务：推荐
 *
 * @author yangcs
 * @date 2025/8/11
 */
@Configuration
@AutoConfigureOrder(100)
public class LocalCacheAutoConfigure {

    @Bean
    @ConditionalOnMissingBean
    public CacheService cacheService() {
        LocalCache localCache = new LocalCache();
        localCache.init();
        return localCache;
    }

}
